package com.pdwl.cashoutpay.util;

import net.sf.json.JSONObject;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.Set;

//import org.json.JSONObject;

public class JsonUtil {
   public static JSONObject  getJson(HttpServletRequest httpReq) throws Exception{
		Map<String, String[]> map = httpReq.getParameterMap();
		Set<String> keySet = map.keySet();
		String str = keySet.toString();
		System.out.println(str);
		//JSONObject json = new JSONObject();	
		
		System.out.println(str.substring(1, str.length()-1));		
		JSONObject json =JSONObject.fromObject(str.substring(1, str.length()-1));		
	    return json;	   
   }


   public  static  String getChannelCode(String res){
	   JSONObject json=JSONObject.fromObject(res);
	   String data=json.getString("data");
	   JSONObject message=JSONObject.fromObject(data);
	   String channelOrderNo=message.getString("channelOrderNo");
	   return channelOrderNo;
   }
}
